package src.io;

import java.io.Serializable;

public class Teacher implements Serializable {
    private  String name;
    private transient int age;
    public Teacher() {
    }

    public Teacher(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    //�Լ������л�
    private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException{
        s.defaultWriteObject();
        s.writeInt(age);
    }

       //�Լ��������л�
       private void readObject(java.io.ObjectInputStream s)
               throws java.io.IOException, ClassNotFoundException{
           s.defaultReadObject();
           this.age=s.readInt();
       }

/*
     private void writeObject(java.io.ObjectOutputStream s)
               throws java.io.IOException{
           s.defaultWriteObject();
           s.writeInt(age);
       }*/
  /*  private void readObject(java.io.ObjectInputStream s)
            throws java.io.IOException, ClassNotFoundException{
        s.defaultReadObject();//??jvm?????????��????????��????��?????
        this.age = s.readInt();//??????stuage??????��?????
    }*/
}
